﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Reflection;

namespace CHGK.web.UI.Core
{
    public class MEFHelper
    {
        CompositionContainer _container;
        #region singleton implementation
        protected MEFHelper()
        {
            _container = new CompositionContainer(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
        }

        private class nested
        {
            public static MEFHelper Instance = new MEFHelper();
        }

        public static MEFHelper Instance
        {
            get
            {
                return nested.Instance;
            }
        }
        #endregion


        public void Fill(object o)
        {
            _container.ComposeParts(o);
        }
    }
}